package views.ebook.com;

/**
 * 关于软件
 * 
 */
import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.IOException;
import java.net.URISyntaxException;

import javax.swing.Box;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;

public class Aboutthesoftware extends JFrame implements ActionListener {
	private JButton jbu1;

	public Aboutthesoftware() {
		this.setSize(748, 442);
		this.setTitle("关于软件");
		this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		this.setLocationRelativeTo(null);
		this.setIconImage(new ImageIcon("src/images/helpwind.png").getImage());
		this.setResizable(false);
		Box bx = Box.createHorizontalBox();
		Box bx1 = Box.createHorizontalBox();
		ImageIcon backIcon = new ImageIcon("src/images/89.png");
		JLabel jbbg = new JLabel(backIcon);
		bx1.add(jbbg);
		bx.add(bx1);

		Box bx2 = Box.createVerticalBox();
		JLabel jb = new JLabel("深圳大学图书管理系统");
		jb.setFont(new Font("楷体", Font.PLAIN, 25));
		JLabel jb2 = new JLabel("技术支持：百度");
		jb2.setFont(new Font("楷体", Font.PLAIN, 25));
		JLabel jb3 = new JLabel("版本：V1.2");
		jb3.setFont(new Font("楷体", Font.PLAIN, 25));
		JLabel jb4 = new JLabel("<html><u>访问公司主页</u></html>");
		jb4.setFont(new Font("楷体", Font.PLAIN, 25));
		jb4.setForeground(Color.blue);
		jbu1 = new JButton("关闭");
		jbu1.setFont(new Font("楷体", Font.PLAIN, 25));
		bx2.add(Box.createVerticalStrut(130));
		bx2.add(jb);
		bx2.add(Box.createVerticalStrut(10));
		bx2.add(jb2);
		bx2.add(Box.createVerticalStrut(10));
		bx2.add(jb3);
		bx2.add(Box.createVerticalStrut(10));
		bx2.add(jb4);

		bx2.add(Box.createHorizontalStrut(10));
		bx2.add(jbu1);
		bx2.add(Box.createVerticalStrut(25));
		jbu1.addActionListener(this);

		bx.add(bx1);
		bx.add(Box.createHorizontalStrut(10));
		bx.add(bx2);
		this.setContentPane(bx);
		this.setVisible(true);

		// 标签访问事件
		jb4.addMouseListener(new MouseAdapter() {
			public void mouseClicked(MouseEvent evt) {
				try {
					java.awt.Desktop.getDesktop().browse(new java.net.URI("http://www.baidu.com/"));
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				} catch (URISyntaxException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
		});
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		// TODO Auto-generated method stub
		if (e.getSource() == jbu1) {
			// 关闭按钮事件
			this.setVisible(false);
		}
	}
}
